﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace carsitem.yuangong
{
    public partial class chazhao : Form
    {
        Sunisoft.IrisSkin.SkinEngine se = null;
        string skinname = "SteelBlack";

        public chazhao()
        {
            InitializeComponent();
            //加载皮肤
            se = new Sunisoft.IrisSkin.SkinEngine();
            se.SkinAllForm = true;
            se.SkinFile = "skin/" + skinname + ".ssk";
        }
        private void button1_Click(object sender, EventArgs e)
        {

            //创建连接对象
            SqlConnection conn = new SqlConnection("Data Source=季白\\MSSQLSERVER04;Initial Catalog=SellCars;Integrated Security=True");
            //打开连接
            conn.Open();
            //2.获取用户输入的值
            string name = this.textBox1.Text;
            //3.书写一条查询语句
            string sql = string.Format("select EmployeeID,DepartID,EmployeeName,Salay,Sex,WorkName,Address,PhoneNumber from Employee where EmployeeName = '{0}'", name);
            //4.执行查询语句
                SqlDataAdapter dap = new SqlDataAdapter(sql, conn);
                //5.填充DataSet对象
                DataTable dl = new DataTable();
                dap.Fill(dl);

                //设置datagridview控件的数据源
                this.dataGridView1.AutoGenerateColumns = false;//取消自动生成列
                this.dataGridView1.DataSource = dl;
        }//查询按钮

        private void button2_Click(object sender, EventArgs e)
        {
            carsitem.MainInterface.MainInterfaceForm mainInterfaceForm = new carsitem.MainInterface.MainInterfaceForm();//把form1传给form2
            mainInterfaceForm.Show();
            this.Hide();//把自己隐藏了
        }//退出功能
         private void chazhao_FormClosed(object sender, FormClosedEventArgs e)
        {
            carsitem.MainInterface.MainInterfaceForm mainInterfaceForm = new carsitem.MainInterface.MainInterfaceForm();//把form1传给form2
        mainInterfaceForm.Show();
            this.Hide();//把自己隐藏了
    }
}
}
